package com.gydz.gydzbaseframeworkboot.SgsE.util;

import com.alibaba.fastjson.JSONObject;
import com.gydz.gydzbaseframeworkboot.SgsE.service.YingSheService;
import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 这个工具类专门用来翻译需要显示的结果
 * Xch 2019/12/16
 */
public class InterpretResultsUtil {

    private static int CodingNum = 0;
    private static Map<String,Map<String,Object>> codingMap = new HashMap<>();

    private static void setMap(){
        if(CodingNum==0){
            String SCCPSubsystem = jsonFile.getSCCPSubsystemCoding();
            Map<String,Object> SCCPSubsystemCodingMap = JSONObject.parseObject(SCCPSubsystem);
            String Map = jsonFile.getMapCoding();
            Map<String,Object> mapOpcodeMap = JSONObject.parseObject(Map);
            String tCAP = jsonFile.gettCAPCoding();
            Map<String,Object> tCAPOpcodeMap = JSONObject.parseObject(tCAP);
            String sCCPP = jsonFile.getsCCPPCoding();
            Map<String,Object> sCCPPpcodeMap = JSONObject.parseObject(sCCPP);
            String CapError = jsonFile.getNewCapErrorCoding();
            Map<String,Object> capErrorCodeMap = JSONObject.parseObject(CapError);
            String Cap = jsonFile.getCapCoding();
            Map<String,Object> capOpcodeMap = JSONObject.parseObject(Cap);
            String MapNewError = jsonFile.getMapNewErrorCoding();
            Map<String,Object> mapNewErrorCodeMap = JSONObject.parseObject(MapNewError);
            String InterfaceId = jsonFile.getInterfaceIdCoding();
            Map<String,Object> interfaceIdCodingMap = JSONObject.parseObject(InterfaceId);
            Map<String,Object> EInterfaceSignalingQueryMap = new HashMap<>();
            Map<String,Object> LInterfaceSignalingQueryMap = new HashMap<>();
            Map<String,Object> YAYMap = new HashMap<>();
            LInterfaceSignalingQueryMap = jsonFile.setLMap(LInterfaceSignalingQueryMap);
            EInterfaceSignalingQueryMap = jsonFile.setEMap(EInterfaceSignalingQueryMap);
            YAYMap = jsonFile.setYuanAndYing(YAYMap);

            Map<String,String> mapStrStr =  new HashMap<>();
            Map<String,Object> mapStrObj =  new HashMap<>();

            mapStrStr = mapStrObjTurnMapStrStr(SCCPSubsystemCodingMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("SCCPSubsystem",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(mapOpcodeMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("Map",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(tCAPOpcodeMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("tCAP",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(sCCPPpcodeMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("sCCPP",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(capErrorCodeMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("CapError",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(capOpcodeMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("Cap",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(mapNewErrorCodeMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("MapNewError",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(interfaceIdCodingMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("InterfaceId",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(LInterfaceSignalingQueryMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("LMap",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(EInterfaceSignalingQueryMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("EMap",mapStrObj);

            mapStrStr = mapStrObjTurnMapStrStr(YAYMap);
            mapStrObj = sortMapByValue(mapStrStr);
            codingMap.put("YAYMap",mapStrObj);
            CodingNum = 1;
        }
    }

    /**
     * Map<String,Object> 转 Map<String,String>
     * @param map
     * @return
     */
    public static Map<String,String> mapStrObjTurnMapStrStr( Map<String,Object> map){
        Map<String,String> map2 = new HashMap<>();
        for(String key : map.keySet()) {
            map2.put(key,map.get(key) + "");
        }
        return map2;
    }

    /*
     * 对Map<String,String>中的value进行排序（正序）
     */
    public static Map<String, Object> sortMapByValue(Map<String, String> unSortMap) {
        if (unSortMap == null || unSortMap.isEmpty()) {
            return null;
        }
        List<Map.Entry<String, String>> listEntry = new ArrayList<>();
        listEntry.addAll(unSortMap.entrySet());
        Collections.sort(listEntry, new Comparator<Map.Entry<String, String>>() {
            @Override
            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
                // String的compareTo方法，返回负数，说明o1在o2的字典顺序之前。
                return o1.getValue().compareTo(o2.getValue());// 此处。getValue改成getKey即可对Map按照key进行排序
            }
        });
        Map<String,Object> sortedMap = new LinkedHashMap<>();
        for(Map.Entry<String, String> entry : listEntry){
            sortedMap.put(entry.getKey(), entry.getValue());
        }
        return sortedMap;
    }

    /*
     * 对Map<String,String>中的value进行排序（正序）
     */
    public static Map<String, String> sortMapByValueStrObj(Map<String, String> unSortMap) {
        if (unSortMap == null || unSortMap.isEmpty()) {
            return null;
        }
        List<Map.Entry<String, String>> listEntry = new ArrayList<>();
        listEntry.addAll(unSortMap.entrySet());
        Collections.sort(listEntry, new Comparator<Map.Entry<String, String>>() {
            @Override
            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
                // String的compareTo方法，返回负数，说明o1在o2的字典顺序之前。
                return o1.getValue().compareTo(o2.getValue());// 此处。getValue改成getKey即可对Map按照key进行排序
            }
        });
        Map<String,String> sortedMap = new LinkedHashMap<>();
        for(Map.Entry<String, String> entry : listEntry){
            sortedMap.put(entry.getKey(), entry.getValue());
        }
        return sortedMap;
    }

    /*
     * 对Map<String,String>中的key进行排序（正序）
     */
    public static Map<String, String> sortMapByKeyStrStr(Map<String, String> unSortMap) {
        if (unSortMap == null || unSortMap.isEmpty()) {
            return null;
        }
        List<Map.Entry<String, String>> listEntry = new ArrayList<>();
        listEntry.addAll(unSortMap.entrySet());
        Collections.sort(listEntry, new Comparator<Map.Entry<String, String>>() {
            @Override
            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
                // String的compareTo方法，返回负数，说明o1在o2的字典顺序之前。
                return o1.getKey().compareTo(o2.getKey());// 此处。getKey改成getValue即可对Map按照value进行排序
            }
        });
        Map<String,String> sortedMap = new LinkedHashMap<>();
        for(Map.Entry<String, String> entry : listEntry){
            sortedMap.put(entry.getKey(), entry.getValue());
        }


        return sortedMap;
    }

    public static String getCodingMap(String name,String str){
        setMap();
        String returnStr = (String)codingMap.get(name).get(str);
        return returnStr==null?str:returnStr;
    }

//    public synchronized static List<YingShe> getCodingList(String name){
//        setMap();
//        return codingMap.get(name).entrySet().stream().map(e -> new YingShe(e.getKey(), e.getValue())).collect(Collectors.toList());
//    }

    /**
     * DPC&OPC编码
     * @param str
     * @return
     */
    public static String opcAndDpcCoding(String str){

        if(str.equals("2817842")){
            return "NAT0";
        }else if(str.equals("4301")){
            return "NAT1";
        }else if(str.equals("2817813")){
            return "DPBJMSC";
        }else if(str.equals("2817814")){
            return "WHMSC";
        }else if(str.equals("2817557")){
            return "DPBJMSC2";
        }else if(str.equals("2817560")){
            return "DPSHMSC2";
        }else if(str.equals("680476")){
            return "DPJNTT";
        }else if(str.equals("2817830")){
            return "DPZZMSC";
        }else if(str.equals("4301")){
            return "NAT1";
        }else if(str.equals("2817586")){
            return "DPJNMSC2";
        }else if(str.equals("2817926")){
            return "DPJNGPRS";
        }else if(str.equals("4304")){
            return "DPJNBSC4";
        }else if(str.equals("4305")){
            return "DPJNBSC5";
        }else if(str.equals("4306")){
            return "DPJNBSC6";
        }else if(str.equals("4307")){
            return "BPJNBSC7";
        }else if(str.equals("4308")){
            return "DPJNBSC8";
        }else if(str.equals("14301")){
            return "DPJNBSC1";
        }else if(str.equals("14302")){
            return "DPJNBSC2";
        }else if(str.equals("14303")){
            return "DPJNBSC3";
        }else{
            return " ";
        }
    }


    /**
     * SCCP子系统编码
     * @param str
     * @return
     */
    public static String SCCPSubsystemCoding(String str){

        if(str.equals("0")){
            return "未定义的子系统号/没有使用";
        }else if(str.equals("1")){
            return "SCCP管理（SCMG）";
        }else if(str.equals("2")){
            return "备用";
        }else if(str.equals("3")){
            return "ISUP";
        }else if(str.equals("4")){
            return "OMAP";
        }else if(str.equals("5")){
            return "移动应用部分（MAP）";
        }else if(str.equals("6")){
            return "HLR";
        }else if(str.equals("7")){
            return "VLR";
        }else if(str.equals("8")){
            return "MSC";
        }else if(str.equals("9")){
            return "EIR";
        }else if(str.equals("10")){
            return "AUC";
        }else if(str.equals("11")){
            return "备用";
        }else if(str.equals("12")){
            return "智能网应用部分（INAP）";
        }else if(str.equals("149")){
            return "SGSN";
        }else if(str.equals("254")){
            return "BSSAP";
        }else if(str.equals("其他")){
            return "备用";
        }else if(str.equals("255")){
            return "扩充备用";
        }else if(str.equals("146")){
            return "CAP";
        }else{
            return " ";
        }
    }

    /**
     * map操作码
     * @param str
     * @return
     */
    public static String mapOpcode(String str){
        if(str.equals("22")){
            return "sendRoutingInfo";
        }else if(str.equals("4")){
            return "provideRoamingNumber";
        }else if(str.equals("6")){
            return "resumeCallHandling";
        }else if(str.equals("73")){
            return "setReportingState";
        }else if(str.equals("74")){
            return "statusReport";
        }else if(str.equals("75")){
            return "remoteUserFree";
        }else if(str.equals("87")){
            return "ist-Alert";
        }else if(str.equals("88")){
            return "ist-Command";
        }else if(str.equals("20")){
            return "releaseResources";
        }else if(str.equals("39")){
            return "prepareGroupCall";
        }else if(str.equals("40")){
            return "sendGroupCallEndSignal";
        }else if(str.equals("41")){
            return "processGroupCallSignalling";
        }else if(str.equals("42")){
            return "forwardGroupCallSignalling";
        }else if(str.equals("84")){
            return "sendGroupCallInfo";
        }else if(str.equals("85")){
            return "sendRoutingInfoForLCS";
        }else if(str.equals("83")){
            return "provideSubscriberLocation";
        }else if(str.equals("86")){
            return "subscriberLocationReport";
        }else if(str.equals("2")){
            return "updateLocation";
        }else if(str.equals("3")){
            return "cancelLocation";
        }else if(str.equals("67")){
            return "purgeMS";
        }else if(str.equals("55")){
            return "sendIdentification";
        }else if(str.equals("23")){
            return "updateGprsLocation";
        }else if(str.equals("70")){
            return "provideSubscriberInfo";
        }else if(str.equals("71")){
            return "anyTimeInterrogation";
        }else if(str.equals("62")){
            return "anyTimeSubscriptionInterrogation";
        }else if(str.equals("65")){
            return "anyTimeModification";
        }else if(str.equals("5")){
            return "noteSubscriberDataModified";
        }else if(str.equals("68")){
            return "prepareHandover";
        }else if(str.equals("29")){
            return "sendEndSignal";
        }else if(str.equals("33")){
            return "processAccessSignalling";
        }else if(str.equals("34")){
            return "forwardAccessSignalling";
        }else if(str.equals("69")){
            return "prepareSubsequentHandover";
        }else if(str.equals("56")){
            return "sendAuthenticationInfo";
        }else if(str.equals("15")){
            return "authenticationFailureReport";
        }else if(str.equals("43")){
            return "checkIMEI";
        }else if(str.equals("7")){
            return "insertSubscriberData";
        }else if(str.equals("8")){
            return "deleteSubscriberData";
        }else if(str.equals("37")){
            return "reset";
        }else if(str.equals("38")){
            return "forwardCheckSS-Indication";
        }else if(str.equals("57")){
            return "restoreData";
        }else if(str.equals("24")){
            return "sendRoutingInfoForGprs";
        }else if(str.equals("25")){
            return "failureReport";
        }else if(str.equals("26")){
            return "noteMsPresentForGprs";
        }else if(str.equals("89")){
            return "noteMM-Event";
        }else if(str.equals("50")){
            return "activateTraceMode";
        }else if(str.equals("51")){
            return "deactivateTraceMode";
        }else if(str.equals("58")){
            return "sendIMSI";
        }else if(str.equals("45")){
            return "sendRoutingInfoForSM";
        }else if(str.equals("46")){
            return "mo-ForwardSM";
        }else if(str.equals("44")){
            return "mt-ForwardSM";
        }else if(str.equals("47")){
            return "reportSM-DeliveryStatus";
        }else if(str.equals("64")){
            return "alertServiceCentre";
        }else if(str.equals("63")){
            return "informServiceCentre";
        }else if(str.equals("66")){
            return "readyForSM";
        }else if(str.equals("21")){
            return "mt-ForwardSM-VGCS";
        }else if(str.equals("10")){
            return "registerSS";
        }else if(str.equals("11")){
            return "eraseSS";
        }else if(str.equals("12")){
            return "activateSS";
        }else if(str.equals("13")){
            return "deactivateSS";
        }else if(str.equals("14")){
            return "interrogateSS";
        }else if(str.equals("59")){
            return "processUnstructuredSS-Request";
        }else if(str.equals("60")){
            return "unstructuredSS-Request";
        }else if(str.equals("61")){
            return "unstructuredSS-Notify";
        }else if(str.equals("17")){
            return "registerPassword";
        }else if(str.equals("18")){
            return "getPassword";
        }else if(str.equals("72")){
            return "ss-InvocationNotification";
        }else if(str.equals("76")){
            return "registerCC-Entry";
        }else if(str.equals("77")){
            return "eraseCC-Entry";
        }else if(str.equals("19")){
            return "processUnstructuredSS-Data";
        }else if(str.equals("16")){
            return "notifySS";
        }else if(str.equals("125")){
            return "forwardChargeAdvice";
        }else if(str.equals("120")){
            return "forwardCUG-Info";
        }else if(str.equals("124")){
            return "buildMPTY";
        }else if(str.equals("123")){
            return "holdMPTY";
        }else if(str.equals("122")){
            return "retrieveMPTY";
        }else if(str.equals("121")){
            return "splitMPTY";
        }else if(str.equals("126")){
            return "explicitCT";
        }else if(str.equals("119")){
            return "accessRegisterCCEntry";
        }else if(str.equals("117")){
            return "callDeflection";
        }else if(str.equals("118")){
            return "userUserService";
        }else if(str.equals("116")){
            return "lcs-LocationNotification";
        }else if(str.equals("115")){
            return "lcs-MOLR";
        }else if(str.equals("114")){
            return "lcs-AreaEventRequest";
        }else if(str.equals("113")){
            return "lcs-AreaEventReport";
        }else if(str.equals("112")){
            return "lcs-AreaEventCancellation";
        }else if(str.equals("111")){
            return "lcs-PeriodicLocationRequest";
        }else if(str.equals("110")){
            return "lcs-LocationUpdate";
        }else if(str.equals("109")){
            return "lcs-PeriodicLocationCancellation";
        }else if(str.equals("255")){
            return "";
        }else{
            return " ";
        }
    }

    /**
     * map错误码
     * @param str1 Err Code :map错误码
     * @param str2  Err Reason:map错误原因
     * @return
     */
    public static String mapErrorCode(String str1,String str2){

        if(str1.equals("1")){//Err Code :map错误码
            if(str2.equals("0")){//Err Reason:map错误原因
                return "imsiUnknown";
            }else if(str2.equals("1")){
                return "gprs-eps-SubscriptionUnknown";
            }else if(str2.equals("2")){
                return "npdbMismatch";
            }else{
                return " ";
            }
        }else if(str1.equals("3")){
            return "unknownMSC";
        }else if(str1.equals("5")){
            return "unidentifiedSubscriber";
        }else if(str1.equals("6")){
            return "absentSubscriberSM";
        }else if(str1.equals("7")){
            return "unknownEquipment";
        }else if(str1.equals("8")){
            if(str2.equals("0")){
                return "plmnRoamingNotAllowed";
            }else if(str2.equals("3")){
                return "operatorDeterminedBarring";
            }else{
                return " ";
            }
        }else if(str1.equals("9")){
            return "illegalSubscriber";
        }else if(str1.equals("10")){
            return "bearerServiceNotProvisioned";
        }else if(str1.equals("11")){
            return "teleserviceNotProvisioned";
        }else if(str1.equals("12")){
            return "illegalEquipment";
        }else if(str1.equals("13")){
            if(str2.equals("0")){
                return "barringServiceActive";
            }else if(str2.equals("1")){
                return "operatorBarring";
            }else{
                return " ";
            }
        }else if(str1.equals("14")){
            return "forwardingViolation";
        }else if(str1.equals("15")){
            if(str2.equals("0")){
                return "incomingCallsBarredWithinCUG";
            }else if(str2.equals("1")){
                return "subscriberNotMemberOfCUG";
            }else if(str2.equals("5")){
                return "requestedBasicServiceViolatesCUG-Constraints";
            }else if(str2.equals("7")){
                return "calledPartySS-InteractionViolation";
            }else{
                return " ";
            }
        }else if(str1.equals("16")){
            return "illegalSS-Operation";
        }else if(str1.equals("17")){
            return "ss-ErrorStatus";
        }else if(str1.equals("18")){
            return "ss-NotAvailable";
        }else if(str1.equals("19")){
            return "ss-SubscriptionViolation";
        }else if(str1.equals("20")){
            return "ss-Incompatibility";
        }else if(str1.equals("21")){
            return "facilityNotSupported";
        }else if(str1.equals("22")){
            return "ongoingGroupCall";
        }else if(str1.equals("25")){
            return "noHandoverNumberAvailable";
        }else if(str1.equals("26")){
            return "subsequentHandoverFailure";
        }else if(str1.equals("27")){
            if(str2.equals("0")){
                return "imsiDetach";
            }else if(str2.equals("1")){
                return "restrictedArea";
            }else if(str2.equals("2")){
                return "noPageResponse";
            }else if(str2.equals("3")){
                return "purgedMS";
            }else{
                return " ";
            }
        }else if(str1.equals("28")){
            return "incompatibleTerminal";
        }else if(str1.equals("29")){
            return "shortTermDenial";
        }else if(str1.equals("30")){
            return "longTermDenial";
        }else if(str1.equals("31")){
            return "subscriberBusyForMT-SMS";
        }else if(str1.equals("32")){
            if(str2.equals("0")){
                return "memoryCapacityExceeded";
            }else if(str2.equals("1")){
                return "equipmentProtocolError";
            }else if(str2.equals("2")){
                return "equipmentNotSM-Equipped";
            }else if(str2.equals("3")){
                return "unknownServiceCentre";
            }else if(str2.equals("4")){
                return "sc-Congestion";
            }else if(str2.equals("5")){
                return "invalidSME-Address";
            }else if(str2.equals("6")){
                return "subscriberNotSC-Subscriber";
            }else{
                return " ";
            }
        }else if(str1.equals("33")){
            return "messageWaitingListFull";
        }else if(str1.equals("34")){
            return "systemFailure";
        }else if(str1.equals("35")){
            return "dataMissing";
        }else if(str1.equals("36")){
            return "unexpectedDataValue";
        }else if(str1.equals("37")){
            if(str2.equals("0")){
                return "undetermined";
            }else if(str2.equals("1")){
                return "invalidFormat";
            }else if(str2.equals("2")){
                return "newPasswordsMismatch";
            }else{
                return " ";
            }
        }else if(str1.equals("38")){
            return "negativePW-Check";
        }else if(str1.equals("39")){
            return "noRoamingNumberAvailable";
        }else if(str1.equals("40")){
            return "tracingBufferFull";
        }else if(str1.equals("42")){
            return "targetCellOutsideGroupCallArea";
        }else if(str1.equals("43")){
            return "numberOfPW-AttemptsViolation";
        }else if(str1.equals("44")){
            return "numberChanged";
        }else if(str1.equals("45")){
            return "busySubscriber";
        }else if(str1.equals("46")){
            return "noSubscriberReply";
        }else if(str1.equals("47")){
            return "forwardingFailed";
        }else if(str1.equals("48")){
            return "or-NotAllowed";
        }else if(str1.equals("49")){
            return "ati-NotAllowed";
        }else if(str1.equals("50")){
            return "noGroupCallNumberAvailable";
        }else if(str1.equals("51")){
            return "resourceLimitation";
        }else if(str1.equals("52")){
            return "unauthorizedRequestingNetwork";
        }else if(str1.equals("53")){
            if(str2.equals("0")){
                return "noAdditionalInformation";
            }else if(str2.equals("1")){
                return "clientNotInMSPrivacyExceptionList";
            }else if(str2.equals("2")){
                return "callToClientNotSetup";
            }else if(str2.equals("3")){
                return "privacyOverrideNotApplicable";
            }else if(str2.equals("4")){
                return "disallowedByLocalRegulatoryRequirements";
            }else if(str2.equals("5")){
                return "unauthorizedPrivacyClass";
            }else if(str2.equals("6")){
                return "unauthorizedCallSessionUnrelatedExternalClient";
            }else if(str2.equals("7")){
                return "unauthorizedCallSessionRelatedExternalClient";
            }else{
                return " ";
            }
        }else if(str1.equals("54")){
            if(str2.equals("0")){
                return "congestion";
            }else if(str2.equals("1")){
                return "insufficientResources";
            }else if(str2.equals("2")){
                return "insufficientMeasurementData";
            }else if(str2.equals("3")){
                return "inconsistentMeasurementData";
            }else if(str2.equals("4")){
                return "locationProcedureNotCompleted";
            }else if(str2.equals("5")){
                return "locationProcedureNotSupportedByTargetMS";
            }else if(str2.equals("6")){
                return "qoSNotAttainable";
            }else if(str2.equals("7")){
                return "positionMethodNotAvailableInNetwork";
            }else if(str2.equals("8")){
                return "positionMethodNotAvailableInLocationArea";
            }else{
                return " ";
            }
        }else if(str1.equals("58")){
            return "unknownOrUnreachableLCSClient";
        }else if(str1.equals("59")){
            return "mm-EventNotSupported";
        }else if(str1.equals("60")){
            return "atsi-NotAllowed";
        }else if(str1.equals("61")){
            return "atm-NotAllowed";
        }else if(str1.equals("62")){
            return "informationNotAvailable";
        }else if(str1.equals("71")){
            return "unknownAlphabet";
        }else if(str1.equals("72")){
            return "ussd-Busy";
        } else{
            return " ";
        }
    }

    /**
     * E业务操作类型
     * @param str1
     * @return
     */
    public static String businessOperationType(String str1,String str2){
        if(str1.equals("1")){
            return "短号码";
        }else if(str1.equals("2")){
            if(str2.equals("0")){
                return "车次号注册";
            }else if(str2.equals("1")){
                return "车次号注销";
            }else if(str2.equals("2")){
                return "车次号查询";
            }else if(str2.equals("3")){
                return "车次号强制注销";
            }else if(str2.equals("4")){
                return "车次号重新注册";
            }else if(str2.equals("5")){
                return "车次号被强制注销";
            }else if(str2.equals("6")){
                return "不唯一车次号功能寻址";
            }else {
                return " ";
            }
        }else if(str1.equals("3")){
            if(str2.equals("0")){
                return "机车号注册";
            }else if(str2.equals("1")){
                return "机车号注销";
            }else if(str2.equals("2")){
                return "机车号查询";
            }else if(str2.equals("3")){
                return "机车号强制注销";
            }else if(str2.equals("4")){
                return "机车号重新注册";
            }else if(str2.equals("5")){
                return "机车号被强制注销";
            }else if(str2.equals("6")){
                return "不唯一机车号功能寻址";
            }else {
                return " ";
            }
        }else if(str1.equals("4")){
            if(str2.equals("0")){
                return "车号功能号注册";
            }else if(str2.equals("1")){
                return "车号功能号注销";
            }else if(str2.equals("2")){
                return "车号功能号查询";
            }else if(str2.equals("3")){
                return "车号功能号强制注销";
            }else if(str2.equals("4")){
                return "车号功能号重新注册";
            }else if(str2.equals("5")){
                return "车号功能号被强制注销";
            }else if(str2.equals("6")){
                return "不唯一车号功能号寻址";
            }else {
                return " ";
            }
        }else if(str1.equals("50")){
            return "语音组呼";
        }else if(str1.equals("51")){
            return "语音广播";
        }else if(str1.equals("6")){
            return "维修、调车组成员";
        }else if(str1.equals("7")){
            return "FAS网络用户号码ISDN";
        }else if(str1.equals("8")){
            return "移动用户号码MSISDN";
        }else if(str1.equals("90")){
            return "铁路专网引示号";
        }else if(str1.equals("91")){
            return "调度用户功能号码";
        }else if(str1.equals("99")){
            return "保留公众紧急呼叫";
        }else{
            return " ";
        }
    }

    /**
     * L业务类型
     * @param str
     * @return
     */
    public static  String businessTypes(String str){
        if(str.equals("0")){
            return "initialDP";
        }else if(str.equals("16")){
            return "assistRequestInstructions";
        }else if(str.equals("17")){
            return "establishTemporaryConnection";
        }else if(str.equals("18")){
            return "disconnectForwardConnection";
        }else if(str.equals("86")){
            return "dFCWithArgument";
        }else if(str.equals("19")){
            return "connectToResource";
        }else if(str.equals("20")){
            return "connect";
        }else if(str.equals("22")){
            return "releaseCall";
        }else if(str.equals("23")){
            return "requestReportBCSMEvent";
        }else if(str.equals("24")){
            return "eventReportBCSM";
        }else if(str.equals("31")){
            return "continue";
        }else if(str.equals("32")){
            return "initiateCallAttempt";
        }else if(str.equals("33")){
            return "resetTimer";
        }else if(str.equals("34")){
            return "furnishChargingInformation";
        }else if(str.equals("35")){
            return "applyCharging";
        }else if(str.equals("36")){
            return "applyChargingReport";
        }else if(str.equals("41")){
            return "callGap";
        }else if(str.equals("44")){
            return "callInformationReport";
        }else if(str.equals("45")){
            return "callInformationRequest";
        }else if(str.equals("46")){
            return "sendChargingInformation";
        }else if(str.equals("47")){
            return "playAnnouncement";
        }else if(str.equals("48")){
            return "promptAndCollectUserInformation";
        }else if(str.equals("49")){
            return "specializedResourceReport";
        }else if(str.equals("53")){
            return "cancel";
        }else if(str.equals("55")){
            return "activityTest";
        }else if(str.equals("88")){
            return "continueWithArgument";
        }else if(str.equals("90")){
            return "disconnectLeg";
        }else if(str.equals("93")){
            return "moveLeg";
        }else if(str.equals("95")){
            return "splitLeg";
        }else if(str.equals("96")){
            return "entityReleased";
        }else if(str.equals("97")){
            return "playTone";
        }else if(str.equals("60")){
            return "initialDPSMS";
        }else if(str.equals("61")){
            return "furnishChargingInformationSMS";
        }else if(str.equals("62")){
            return "connectSMS";
        }else if(str.equals("63")){
            return "requestReportSMSEvent";
        }else if(str.equals("64")){
            return "eventReportSMS";
        }else if(str.equals("65")){
            return "continueSMS";
        }else if(str.equals("66")){
            return "releaseSMS";
        }else if(str.equals("67")){
            return "resetTimerSMS";
        }else if(str.equals("70")){
            return "activityTestGPRS";
        }else if(str.equals("71")){
            return "applyChargingGPRS";
        }else if(str.equals("72")){
            return "applyChargingReportGPRS";
        }else if(str.equals("73")){
            return "cancelGPRS";
        }else if(str.equals("74")){
            return "connectGPRS";
        }else if(str.equals("75")){
            return "continueGPRS";
        }else if(str.equals("76")){
            return "entityReleasedGPRS";
        }else if(str.equals("77")){
            return "furnishChargingInformationGPRS";
        }else if(str.equals("78")){
            return "initialDPGPRS";
        }else if(str.equals("79")){
            return "releaseGPRS";
        }else if(str.equals("80")){
            return "eventReportGPRS";
        }else if(str.equals("81")){
            return "requestReportGPRSEvent";
        }else if(str.equals("82")){
            return "resetTimerGPRS";
        }else if(str.equals("83")){
            return "sendChargingInformationGPRS";
        }else if(str.equals("255")){
            return "";
        }else{
            return " ";
        }
    }

    /**
     * L
     * Cap错误码
     * @param str1 Err Code :cap错误码
     * @param str2  Err Reason:cap错误原因
     * @return
     */
    public static String capErrorCode(String str1,String str2){
        if(str1.equals("0")){
            return "canceled";
        }else if(str1.equals("1")){
            if(str2.equals("0")){
                return "unknownOperation";
            }else if(str2.equals("1")){
                return "tooLate";
            }else if(str2.equals("2")){
                return "operationNotCancellable";
            }else{
                return " ";
            }
        }else if(str1.equals("3")){
            return "eTCFailed";
        }else if(str1.equals("4")){
            return "improperCallerResponse";
        }else if(str1.equals("6")){
            return "missingCustomerRecord";
        }else if(str1.equals("7")){
            return "missingParameter";
        }else if(str1.equals("8")){
            return "parameterOutOfRange";
        }else if(str1.equals("10")){
            if(str2.equals("1")){
                return "unknownRequestedInfo";
            }else if(str2.equals("2")){
                return "requestedInfoNotAvailable";
            }else{
                return " ";
            }
        }else if(str1.equals("12")){
            if(str2.equals("0")){
                return "generic";
            }else if(str2.equals("1")){
                return "unobtainable";
            }else if(str2.equals("2")){
                return "congestion";
            }else{
                return " ";
            }
        }else if(str1.equals("13")){
            if(str2.equals("0")){
                return "unavailableResources";
            }else if(str2.equals("1")){
                return "componentFailure";
            }else if(str2.equals("2")){
                return "basicCallProcessingException";
            }else if(str2.equals("3")){
                return "resourceStatusFailure";
            }else if(str2.equals("4")){
                return "endUserFailure";
            }else{
                return " ";
            }
        }else if(str1.equals("14")){
            return "unexpectedComponentSequence";
        }else if(str1.equals("15")){
            return "unexpectedDataValue";
        }else if(str1.equals("16")){
            return "unexpectedParameter";
        }else if(str1.equals("17")){
            return "unknownLegID";
        }else if(str1.equals("50")){
            return "unknownPDPID";
        }else if(str1.equals("51")){
            return "unknownCSID";
        }else{
            return " ";
        }
    }

    /**
     * SCCP操作码 EL业务
     * @param str
     * @return
     */
    public static String sCCPPpcode(String str){
        if(str.equals("1")){
            return "CR";
        }else if(str.equals("2")){
            return "CC";
        }else if(str.equals("3")){
            return "CREF";
        }else if(str.equals("4")){
            return "RLSD";
        }else if(str.equals("5")){
            return "RLC";
        }else if(str.equals("6")){
            return "DT1";
        }else if(str.equals("7")){
            return "DT2";
        }else if(str.equals("8")){
            return "AK";
        }else if(str.equals("9")){
            return "UDT";
        }else if(str.equals("10")){
            return "UDTS";
        }else if(str.equals("11")){
            return "ED";
        }else if(str.equals("12")){
            return "EA";
        }else if(str.equals("13")){
            return "RSR";
        }else if(str.equals("14")){
            return "RSC";
        }else if(str.equals("15")){
            return "ERR";
        }else if(str.equals("16")){
            return "IT";
        }else if(str.equals("17")){
            return "XUDT";
        }else if(str.equals("18")){
            return "XUDTS";
        }else if(str.equals("19")){
            return "LUDT";
        }else if(str.equals("20")){
            return "LUDTS";
        }else if(str.equals("255")){
            return "";
        }else {
            return " ";
        }
    }

    /**
     * E_L业务
     * TCAP操作码
     */
    public static String tCAPOpcode(String str){
//        if(str.equals("1")){
//            return "Unidirectional";
//        }else if(str.equals("2")){
//            return "Begin";
//        }else if(str.equals("3")){
//            return "保留";
//        }else if(str.equals("4")){
//            return "End";
//        }else if(str.equals("5")){
//            return "Continue";
//        }else if(str.equals("6")){
//            return "保留";
//        }else if(str.equals("7")){
//            return "Abort";
//        }else if(str.equals("255")){
//            return "";
//        }else{
//            return " ";
//        }
        if(str.equals("97")){
            return "Unidirectional";
        }else if(str.equals("98")){
            return "Begin";
        }else if(str.equals("99")){
            return "保留";
        }else if(str.equals("100")){
            return "End";
        }else if(str.equals("101")){
            return "Continue";
        }else if(str.equals("102")){
            return "保留";
        }else if(str.equals("103")){
            return "Abort";
        }else if(str.equals("255")){
            return "其他";
        }else{
            return " ";
        }
    }

    /**
     * cap操作码
     */
    public static String capOpcode(String str){
        if(str.equals("0")){
            return "initialDP";
        }else if(str.equals("16")){
            return "assistRequestInstructions";
        }else if(str.equals("17")){
            return "establishTemporaryConnection";
        }else if(str.equals("18")){
            return "disconnectForwardConnection";
        }else if(str.equals("86")){
            return "dFCWithArgument";
        }else if(str.equals("19")){
            return "connectToResource";
        }else if(str.equals("20")){
            return "connect";
        }else if(str.equals("22")){
            return "releaseCall";
        }else if(str.equals("23")){
            return "requestReportBCSMEvent";
        }else if(str.equals("24")){
            return "eventReportBCSM";
        }else if(str.equals("31")){
            return "continue";
        }else if(str.equals("32")){
            return "initiateCallAttempt";
        }else if(str.equals("33")){
            return "resetTimer";
        }else if(str.equals("34")){
            return "furnishChargingInformation";
        }else if(str.equals("35")){
            return "applyCharging";
        }else if(str.equals("36")){
            return "applyChargingReport";
        }else if(str.equals("41")){
            return "callGap";
        }else if(str.equals("44")){
            return "callInformationReport";
        }else if(str.equals("45")){
            return "callInformationRequest";
        }else if(str.equals("46")){
            return "sendChargingInformation";
        }else if(str.equals("47")){
            return "playAnnouncement";
        }else if(str.equals("48")){
            return "promptAndCollectUserInformation";
        }else if(str.equals("49")){
            return "specializedResourceReport";
        }else if(str.equals("53")){
            return "cancel";
        }else if(str.equals("55")){
            return "activityTest";
        }else if(str.equals("88")){
            return "continueWithArgument";
        }else if(str.equals("90")){
            return "disconnectLeg";
        }else if(str.equals("93")){
            return "moveLeg";
        }else if(str.equals("95")){
            return "splitLeg";
        }else if(str.equals("96")){
            return "entityReleased";
        }else if(str.equals("97")){
            return "playTone";
        }else if(str.equals("60")){
            return "initialDPSMS";
        }else if(str.equals("61")){
            return "furnishChargingInformationSMS";
        }else if(str.equals("62")){
            return "connectSMS";
        }else if(str.equals("63")){
            return "requestReportSMSEvent";
        }else if(str.equals("64")){
            return "eventReportSMS";
        }else if(str.equals("65")){
            return "continueSMS";
        }else if(str.equals("66")){
            return "releaseSMS";
        }else if(str.equals("67")){
            return "resetTimerSMS";
        }else if(str.equals("70")){
            return "activityTestGPRS";
        }else if(str.equals("71")){
            return "applyChargingGPRS";
        }else if(str.equals("72")){
            return "applyChargingReportGPRS";
        }else if(str.equals("73")){
            return "cancelGPRS";
        }else if(str.equals("74")){
            return "connectGPRS";
        }else if(str.equals("75")){
            return "continueGPRS";
        }else if(str.equals("76")){
            return "entityReleasedGPRS";
        }else if(str.equals("77")){
            return "furnishChargingInformationGPRS";
        }else if(str.equals("78")){
            return "initialDPGPRS";
        }else if(str.equals("79")){
            return "releaseGPRS";
        }else if(str.equals("80")){
            return "eventReportGPRS";
        }else if(str.equals("81")){
            return "requestReportGPRSEvent";
        }else if(str.equals("82")){
            return "resetTimerGPRS";
        }else if(str.equals("83")){
            return "sendChargingInformationGPRS";
        }else if(str.equals("255")){
            return "";
        }else{
            return " ";
        }
    }

    /**
     * FC功能码翻译
     * @param str1  uintEOpFC
     * @param str2 uintEOpCT
     * @return
     */
    public static String FCFunctionCode(String str1,String str2){

        if(str2.equals("2") || str2.equals("3") || str2.equals("4")){
            if(str1.equals("0")){
                return "为告警保留";
            }else if(str1.equals("1")){
                return "本务机司机";
            }else if(str1.equals("2") || str1.equals("3") || str1.equals("4") || str1.equals("5") ){
                return "补机司机";
            }else if(str1.equals("6")){
                return "保留传真使用";
            }else if(str1.equals("7")){
                return "车上内部通信";
            }else if(str1.equals("8")){
                return "车内广播";
            }else if(str1.equals("9")){
                return "保留国际使用";
            }else if(str1.equals("10")){
                return "列车长1";
            }else if(str1.equals("11")){
                return "列车长2";
            }else if(str1.equals("12") || str1.equals("13") || str1.equals("14") || str1.equals("15") || str1.equals("16") || str1.equals("17") || str1.equals("18") || str1.equals("19") ){
                return "保留国际使用（列车员）";
            }else if(str1.equals("20")){
                return "餐车主任";
            }else if(str1.equals("21") ||  str1.equals("22") ||  str1.equals("23") ||  str1.equals("24") ||  str1.equals("25") ||  str1.equals("26") ||  str1.equals("27")){
                return "保留国际使用（餐车人员、列车员）";
            }else if(str1.equals("28")){
                return "乘检人员";
            }else if(str1.equals("29")){
                return "列检人员";
            }else if(str1.equals("30")){
                return "铁路安全服务领导";
            }else if(str1.equals("31")){
                return "乘警长";
            }else if(str1.equals("32") || str1.equals("33") || str1.equals("34") || str1.equals("35") || str1.equals("36") || str1.equals("37") || str1.equals("38") || str1.equals("39")){
                return "保留国际使用（乘警）";
            }else if(str1.equals("40")){
                return "ETCS/CTCS使用";
            }else if(str1.equals("41") || str1.equals("42") || str1.equals("43") || str1.equals("44") || str1.equals("45") || str1.equals("46") || str1.equals("47") || str1.equals("48") || str1.equals("49")){
                return "保留国际使用（ETCS/CTCS）";
            }else if(str1.equals("50")){
                return "车载记录器";
            }else if(str1.equals("51")){
                return "故障诊断";
            }else if(str1.equals("52")){
                return "列车数据总线";
            }else if(str1.equals("53")){
                return "列车位置系统";
            }else if(str1.equals("54")){
                return "保留国际使用（车载设备应用）";
            }else if(str1.equals("60")){
                return "预先录制的旅客信息";
            }else if(str1.equals("61")){
                return "旅客信息显示单元";
            }else if(str1.equals("62")){
                return "旅客服务广播室";
            }else if(str1.equals("63")){
                return "保留国际使用（旅客服务）";
            }else if(str1.equals("70")){
                return "保留国际使用";
            }else if(str1.equals("80")){
                return "保留国际使用";
            }else if(str1.equals("81")){
                return "本务机司机手持台";
            }else if(str1.equals("82") || str1.equals("83")|| str1.equals("84")|| str1.equals("85")){
                return "补机司机手持台";
            }else if(str1.equals("86")){
                return "运转车长";
            }else if(str1.equals("87") || str1.equals("88") || str1.equals("89")){
                return "保留国内使用";
            }else if(str1.equals("90") || str1.equals("91") || str1.equals("92") || str1.equals("93") || str1.equals("94") || str1.equals("95") || str1.equals("96") || str1.equals("97") || str1.equals("98") || str1.equals("99")){
                return "保留国内使用";
            }else{
                return " ";
            }
        }else if(str2.equals("91")){
            if(str1.equals("0")){
                return "预留";
            }else if(str1.equals("1")){
                return "列车调度员";
            }else if(str1.equals("2")){
                return "预留";
            }else if(str1.equals("5")){
                return "车站（场）、编组场（分场）值班员（主信号楼）";
            }else if(str1.equals("6")){
                return "车站（场）、编组场（分场）值班员（其他信号楼）";
            }else if(str1.equals("10")){
                return "车站（场）调度值班员";
            }else if(str1.equals("11")){
                return "车站（场）内勤助理值班员";
            }else if(str1.equals("12")){
                return "车站（场）计划调度值班员";
            }else if(str1.equals("13")){
                return "车站（场）电力值班员";
            }else if(str1.equals("14")){
                return "车站（场）内其他值班员";
            }else if(str1.equals("20")){
                return "预留";
            }else if(str1.equals("21")){
                return "车站（场）1～9站台外勤助理值班员";
            }else if(str1.equals("30")){
                return "机车调度员";
            }else if(str1.equals("31")){
                return "机务段调度员";
            }else if(str1.equals("32")){
                return "机务折返段调度员";
            }else if(str1.equals("33")){
                return "机务段运转值班员";
            }else if(str1.equals("34")){
                return "机务折返段运转值班员";
            }else if(str1.equals("35")){
                return "列车段（车务段）值班员";
            }else if(str1.equals("36")){
                return "列车段（客运段）值班员";
            }else if(str1.equals("37")){
                return "救援列车主任";
            }else if(str1.equals("38")){
                return "预留";
            }else if(str1.equals("40")){
                return "货运调度员";
            }else if(str1.equals("41")){
                return "中间站（区段站）货运室值班员";
            }else if(str1.equals("42")){
                return "中间站（区段站）货运员";
            }else if(str1.equals("43")){
                return "中间站（编组站）货运室值班员";
            }else if(str1.equals("44")){
                return "中间站（编组站）货运员";
            }else if(str1.equals("45")){
                return "中间站（货运站）货运室值班员";
            }else if(str1.equals("46")){
                return "中间站（货运站）货运员";
            }else if(str1.equals("47")){
                return "预留";
            }else if(str1.equals("50")){
                return "牵引供电调度员";
            }else if(str1.equals("51")){
                return "牵引变电所值班员";
            }else if(str1.equals("52")){
                return "电力机务段值班员";
            }else if(str1.equals("53")){
                return "电力折返段值班员";
            }else if(str1.equals("54")){
                return "接触网工区值班员";
            }else if(str1.equals("55")){
                return "开闭所值班员";
            }else if(str1.equals("56")){
                return "分区所值班员";
            }else if(str1.equals("57")){
                return "自耦变电所值班员";
            }else if(str1.equals("58")){
                return "供电段调度室值班员";
            }else if(str1.equals("59")){
                return "“V亭”控制站值班员";
            }else if(str1.equals("6X")){
                return "预留";
            }else if(str1.equals("70")){
                return "预留";
            }else if(str1.equals("71")){
                return "货运计划员";
            }else if(str1.equals("72")){
                return "列检值班员";
            }else if(str1.equals("73")){
                return "红外线值班员";
            }else if(str1.equals("74")){
                return "红外线调度员";
            }else if(str1.equals("75")){
                return "内勤车号员";
            }else if(str1.equals("76")){
                return "商检组长";
            }else if(str1.equals("77")){
                return "商检员";
            }else if(str1.equals("78")){
                return "预留";
            }else if(str1.equals("80")){
                return "电务调度员、值班员";
            }else if(str1.equals("81")){
                return "车务调度员、值班员";
            }else if(str1.equals("82")){
                return "工务调度员、值班员";
            }else if(str1.equals("83")){
                return "供电调度员、值班员";
            }else if(str1.equals("84")){
                return "水电调度员、值班员";
            }else if(str1.equals("85")){
                return "机务调度员、值班员";
            }else if(str1.equals("86")){
                return "车辆调度员、值班员";
            }else if(str1.equals("87")){
                return "公安调度员、值班员";
            }else if(str1.equals("88")){
                return "预留";
            }else if(str1.equals("90")){
                return "救援中心指挥员";
            }else if(str1.equals("91")){
                return "应急指挥现场指挥员";
            }else if(str1.equals("92")){
                return "预留";
            }else{
                return " ";
            }
        }else if(str2.equals("6")){
            if(str1.equals("")){
                return "";
            }else if(str1.equals("")){
                return "";
            }else{
                return " ";
            }
        }else{
            return " ";
        }

    }

//    /**
//     * 截取数据内容里的"frame_data"
//     */
//    public static String cutUutFrameData(String str){
//        if(str!=""&&str!=null&&str.contains("frame_data")){
//            JSONArray jsonArray = JSONArray.fromObject("[" + str + "]");
//            for (int i = 0; i < jsonArray.size(); i++) {
//                str = jsonArray.getJSONObject(i).getString("frame_data");
//            }
//
//            str = str.replace('[',' ');
//            str = str.replace(']',' ');
//            str = str.replace('"',' ');
//            str = str.replace('"',' ');
//        }
//        return str;
//    }
//
//    /**
//     * 截取数据内容里的"frame_packet"
//     */
//    public static String cutUutFramePacket(String str){
//        JSONArray jsonArray = JSONArray.fromObject("[" + str + "]");
//        for (int i = 0; i < jsonArray.size(); i++) {
//            str = jsonArray.getJSONObject(i).getString("frame_packet");
//        }
//
//        str = str.replace('[',' ');
//        str = str.replace(']',' ');
//        str = str.replace('"',' ');
//        str = str.replace('"',' ');
//        return str;
//    }


    /**
     * 寻址类型
     * @param str1  intCapServiceFlag
     * @return
     */
    public static String intCapServiceFlag(String str1){

        if(str1.equals("0")){
            return "功能寻址";
        }else if(str1.equals("1")){
            return "基于位置的寻址";
        }else if(str1.equals("2")){
            return "呼叫限制";
        }else if(str1.equals("4")){
            return "其他";
        }else if(str1.equals("255")){
            return "信令";
        }else{
            return "";
        }
    }


    /**
     * 处理结果
     * @param str1  uintServiceFlag
     * @return
     */
    public static String processingResults(String str1){

        if(str1.equals("0")){
            return "成功";
        }else if(str1.equals("1")){
            return "失败或拒绝";
        }else if(str1.equals("2")){
            return "超时";
        }else if(str1.equals("3")){
            return "其他不识别";
        }else{
            return "";
        }
    }

    //修改主叫时间的格式
    public static String getZhuJiaoTime(String str){
        String[] arr = str.split("");
        String returnStr = "";
        String tem = "";
        for (int i = 0; i < arr.length; i++) {
            if(i%2==0){
                tem = arr[i];
            }else{
                arr[i-1] = arr[i];
                arr[i] = tem;
            }
        }
        try {
            Date date = new SimpleDateFormat("yyyyMMddHHmmssSSS").parse(StringUtils.join(arr));
            returnStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS").format(date);
        } catch (ParseException e) {
            //System.out.println("");·
        }
        return returnStr;
    }

    public static String getLacAndCi(String str){
        return str.substring(5,10) + "_"+str.substring(11);
    }

    public static String getSData(String value){
        //此处获取截取字符串方法存在漏洞    indexOf("]")-1 这会扫描整个value值 会导致 索引位置异常（如前面存在]）
//        String middleValue = value.substring(value.lastIndexOf("text")+6,value.indexOf("]")-1).trim();
        //下面为修正方法
        String middleValue = value.substring(value.lastIndexOf("text")+6,value.lastIndexOf("]")-1).trim();
        String returnValue = middleValue.substring(1,middleValue.length()-1);
        return returnValue;
    }

    /**
     * EL业务的功能号业务结果翻译
     * @return
     */
    public static String uintEFMResTranslation(String str){

        if(str.equals("1")){
            return "USSD-注册成功";
        }else if(str.equals("2")){
            return "USSD-注销成功";
        }else if(str.equals("3")){
            return "USSD-Follow Me 功能注册至<MSISDN>";
        }else if(str.equals("22")){
            return "HLR未授权请求";
        }else if(str.equals("41")){
            return "未知的功能号";
        }else if(str.equals("42")){
            return "未申请的FM业务";
        }else if(str.equals("61")){
            return "已有用户注册";
        }else if(str.equals("62")){
            return "用户未注册";
        }else if(str.equals("63")){
            return "功能号未注册到该MSISDN号码，注销失败(包含强制注销)";
        }else if(str.equals("64")){
            return "未授权请求";
        }else{
            return " ";
        }

    }

    /**
     *
     * @param str
     * @return
     */
    public static String calledFnFlagJson(String str){
        if(str.equals("0")){
            return "短号";
        }else if(str.equals("1")){
            return "车次功能号";
        }else if(str.equals("2")){
            return "机车功能号";
        }else if(str.equals("3")){
            return "车号功能号";
        }else if(str.equals("4")){
            return "语音组呼";
        }else if(str.equals("5")){
            return "语音广播";
        }else if(str.equals("6")){
            return "维修和调车";
        }else if(str.equals("7")){
            return "FAS呼叫";
        }else if(str.equals("8")){
            return "调度呼叫";
        }else if(str.equals("255")){
            return "信令";
        }else{
            return "";
        }
    }

    /**
     * map错误码
     * @return
     */
    public static String intErrCodeMapErrorCode(String str){
        if(str.equals("1")){
            return "unknownSubscriber";
        }else if(str.equals("2")){
            return "unknownBaseStation";
        }else if(str.equals("3")){
            return "unknownMSC";
        }else if(str.equals("5")){
            return "unidentifiedSubscriber";
        }else if(str.equals("6")){
            return "absentsubscriberSM";
        }else if(str.equals("7")){
            return "unknownEquipment";
        }else if(str.equals("8")){
            return "roamingNotAllowed";
        }else if(str.equals("9")){
            return "illegalSubscriber";
        }else if(str.equals("10")){
            return "bearerServiceNotProvisioned";
        }else if(str.equals("11")){
            return "teleserviceNotProvisioned";
        }else if(str.equals("12")){
            return "illegalEquipment";
        }else if(str.equals("13")){
            return "callBarred";
        }else if(str.equals("14")){
            return "forwardingViolation";
        }else if(str.equals("15")){
            return "cug-Reject";
        }else if(str.equals("16")){
            return "illegalSS-Operation";
        }else if(str.equals("17")){
            return "ss-ErrorStatus";
        }else if(str.equals("18")){
            return "ss-NotAvailable";
        }else if(str.equals("19")){
            return "ss-SubscriptionViolation";
        }else if(str.equals("20")){
            return "ss-Incompatibility";
        }else if(str.equals("21")){
            return "facilityNotSupported";
        }else if(str.equals("23")){
            return "invalidTargetBaseStation";
        }else if(str.equals("24")){
            return "noRadioResourceAvailable";
        }else if(str.equals("25")){
            return "noHandoverNumberAvailable";
        }else if(str.equals("26")){
            return "subsequentHandoverFailure";
        }else if(str.equals("27")){
            return "absentSubscriber";
        }else if(str.equals("28")){
            return "incompatibleTerminal";
        }else if(str.equals("29")){
            return "shortTermDenial";
        }else if(str.equals("30")){
            return "longTermDenial";
        }else if(str.equals("31")){
            return "subscriberBusyForMT-SMS";
        }else if(str.equals("32")){
            return "sm-DeliveryFailure";
        }else if(str.equals("33")){
            return "messageWaitingListFull";
        }else if(str.equals("34")){
            return "systemFailure";
        }else if(str.equals("35")){
            return "dataMissing";
        }else if(str.equals("36")){
            return "unexpectedDataValue";
        }else if(str.equals("37")){
            return "pw-RegistrationFailure";
        }else if(str.equals("38")){
            return "negativePW-Check";
        }else if(str.equals("39")){
            return "noRoamingNumberAvailable";
        }else if(str.equals("40")){
            return "tracingBufferFull";
        }else if(str.equals("43")){
            return "numberOfPW-AttemptsViolation";
        }else if(str.equals("44")){
            return "numberChanged";
        }else if(str.equals("45")){
            return "busySubscriber";
        }else if(str.equals("46")){
            return "noSubscriberReply";
        }else if(str.equals("47")){
            return "forwardingFailed";
        }else if(str.equals("48")){
            return "or-NotAllowed";
        }else if(str.equals("49")){
            return "ati-NotAllowed";
        }else if(str.equals("50")){
            return "noGroupCallNumberAvailable";
        }else if(str.equals("51")){
            return "resourceLimitation";
        }else if(str.equals("52")){
            return "unauthorizedRequestingNetwork";
        }else if(str.equals("53")){
            return "unauthorizedLCSClient";
        }else if(str.equals("54")){
            return "positionMethodFailure";
        }else if(str.equals("58")){
            return "unknownOrUnreachableLCSClient";
        }else if(str.equals("71")){
            return "unknownAlphabet";
        }else if(str.equals("72")){
            return "ussd-Busy";
        }else{
            return "";
        }
    }

    /**
     * L接口的话单实体字段翻译数据库字段(L接口话单下钻共用)
     * @param field
     * @return
     */
    public static String lFieldMapping(String field){

        if(field.equals("dtsTime")){
            return "dtSTime";
        }else if(field.equals("dteTime")){
            return "dtETime";
        }else if(field.equals("intDuration")){
            return "uintDuration";
        }else if(field.equals("vcCallingImsi")){
            return "vcCallingImsi";
        }else if(field.equals("vcCalledImsi")){
            return "vcCalledImsi";
        }else if(field.equals("vcCallingNumber")){
            return "vcCallingNumber";
        }else if(field.equals("vcCalledNumber")){
            return "vcCalledNumber";
        }else if(field.equals("intOpc")){
            return "uintOpc";
        }else if(field.equals("intDpc")){
            return "uintDpc";
        }else if(field.equals("biCallingGT")){
            return "vcCallingGT";
        }else if(field.equals("biCalledGT")){
            return "vcCalledGT";
        }else if(field.equals("intCallingSSN")){
            return "uintCallingSSN";
        }else if(field.equals("intCalledSSN")){
            return "uintCalledSSN";
        }else if(field.equals("intCallingFN")){
            return "vcCallingFN";
        }else if(field.equals("intCalledFN")){
            return "vcCalledFN";
        }else if(field.equals("intOpCode")){
            return "uintOpCode";
        }else if(field.equals("intErrCode")){
            return "uintErrCode";
        }else if(field.equals("intCapServiceFlag")){
            return "uintCapServiceFlag";
        }else if(field.equals("intServiceFlag")){
            return "uintServiceFlag";
        }else if(field.equals("vcOCalledNumber")){
            return "vcOCalledNumber";
        }else if(field.equals("vcCamelLac")){
            return "vcCamelLac";
        }else if(field.equals("vcCamelCellID")){
            return "vcCamelCellID";
        }else if(field.equals("intResponseDuration")){
            return "uintResponseDuration";
        }else if(field.equals("sourceData")){
            return "vcSourceData";
        }else if(field.equals("vcCallingTrainID")){
            return "vcCallingTrainID";
        }else if(field.equals("vcCalledTrainID")){
            return "vcCalledTrainID";
        }else if(field.equals("vcCallingTrainNo")){
            return "vcCallingTrainNo";
        }else if(field.equals("vcCalledTrainNo")){
            return "vcCalledTrainNo";
        }else{
            return "";
        }

    }

    /**
     * CD接口的话单实体字段翻译数据库字段
     * @param field
     * @return
     */
    public static String cDFieldMapping(String field){
        if(field.equals("dtsTime")){
            return "dtSTime";
        }else if(field.equals("dteTime")){
            return "dtETime";
        }else if(field.equals("intDuration")){
            return "uintDuration";
        }else if(field.equals("vcCallingImsi")){
            return "vcCallingImsi";
        }else if(field.equals("vcCalledImsi")){
            return "vcCalledImsi";
        }else if(field.equals("vcCallingNumber")){
            return "vcCallingNumber";
        }else if(field.equals("vcCalledNumber")){
            return "vcCalledNumber";
        }else if(field.equals("vcCallingTrainID")){
            return "vcCallingTrainID";
        }else if(field.equals("vcCalledTrainID")){
            return "vcCalledTrainID";
        }else if(field.equals("intOpc")){
            return "uintOpCode";
        }else if(field.equals("intDpc")){
            return "uintDpc";
        }else if(field.equals("biCallingGT")){
            return "vcCallingGT";
        }else if(field.equals("biCalledGT")){
            return "vcCalledGT";
        }else if(field.equals("intCallingSSN")){
            return "uintCallingSSN";
        }else if(field.equals("intCalledSSN")){
            return "uintCalledSSN";
        }else if(field.equals("vcCallingFN")){
            return "vcCallingFN";
        }else if(field.equals("vcCalledFN")){
            return "vcCalledFN";
        }else if(field.equals("intOpCode")){
            return "uintOpCode";
        }else if(field.equals("intErrCode")){
            return "uintErrCode";
        }else if(field.equals("intServiceFlag")){
            return "uintServiceFlag";
        }else if(field.equals("eopFC")){
            return "uintEOpFC";
        }else if(field.equals("vcUssdStringSend")){
            return "vcUssdStringSend";
        }else if(field.equals("vcUssdStringReceive")){
            return "vcUssdStringReceive";
        }else if(field.equals("intResponseDuration")){
            return "uintResponseDuration";
        }else if(field.equals("sourceData")){
            return "vcSourceData";
        }else if(field.equals("terminalingFN")){
            return "vcCallingFN";
        }else if(field.equals("terminaledFN")){
            return "vcCalledFN";
        }else{
            return "";
        }
    }

    /**
     * eg接口的话单实体字段翻译数据库字段(map统计 e下钻共用)
     * @param field
     * @return
     */
    public static String eGFieldMapping(String field){
        if(field.equals("dtsTime")){
            return "dtSTime";
        }else if(field.equals("dteTime")){
            return "dtETime";
        }else if(field.equals("intDuration")){
            return "uintDuration";
        }else if(field.equals("vcCallingImsi")){
            return "vcCallingImsi";
        }else if(field.equals("vcCalledImsi")){
            return "vcCalledImsi";
        }else if(field.equals("vcCallingNumber")){
            return "vcCallingNumber";
        }else if(field.equals("vcCalledNumber")){
            return "vcCalledNumber";
        }else if(field.equals("vcCallingTrainID")){
            return "vcCallingTrainID";
        }else if(field.equals("vcCalledTrainID")){
            return "vcCalledTrainID";
        }else if(field.equals("intOpc")){
            return "uintOpc";
        }else if(field.equals("intDpc")){
            return "uintDpc";
        }else if(field.equals("biCallingGT")){
            return "vcCallingGT";
        }else if(field.equals("biCalledGT")){
            return "vcCalledGT";
        }else if(field.equals("intCallingSSN")){
            return "uintCallingSSN";
        }else if(field.equals("intCalledSSN")){
            return "uintCalledSSN";
        }else if(field.equals("intOpCode")){
            return "uintOpCode";
        }else if(field.equals("intResponseDuration")){
            return "uintResponseDuration";
        }else if(field.equals("sourceData")){
            return "vcSourceData";
        }else if(field.equals("vcCallingFN")){
            return "vcCallingFN";
        }else if(field.equals("vcCalledFN")){
            return "vcCalledFN";
        }else {
            return "";
        }
    }

    /**
     * eAndL业务接口的话单实体字段翻译数据库字段
     * @param field
     * @return
     */
    public static String eAndLBusinessFieldMapping(String field){
        if(field.equals("dtsTime")){
            return "dtSTime";
        }else if(field.equals("vcCallingImsi")){
            return "vcCallingImsi";
        }else if(field.equals("vcCalledImsi")){
            return "vcCalledImsi";
        }else if(field.equals("vcCallingNumber")){
            return "vcCallingNumber";
        }else if(field.equals("vcCalledNumber")){
            return "vcCalledNumber";
        }else if(field.equals("trainID")){
            return "vcTrainID";
        }else if(field.equals("intOpc")){
            return "uintOpc";
        }else if(field.equals("intDpc")){
            return "uintDpc";
        }else if(field.equals("intSLS")){
            return "uintSls";
        }else if(field.equals("biCallingGT")){
            return "vcCallingGT";
        }else if(field.equals("biCalledGT")){
            return "vcCalledGT";
        }else if(field.equals("intCallingSSN")){
            return "uintCallingSSN";
        }else if(field.equals("intCalledSSN")){
            return "uintCalledSSN";
        }else if(field.equals("intMTPType")){
            return "uintMtpType";
        }else if(field.equals("intSCCPType")){
            return "uintSccpType";
        }else if(field.equals("intTcapMessageType")){
            return "uintTcapMessageType";
        }else if(field.equals("intOpCode")){
            return "uintOpCode";
        }else if(field.equals("eopCode")){
            return "uintEOpCode";
        }else if(field.equals("businessResults")){
            return "uintEFMRes";
        }else if(field.equals("eOpGID")){
            return "vcEOpGID";
        }else if(field.equals("eOpLN")){
            return "vcEOpLN";
        }else if(field.equals("eOpFC")){
            return "uintEOpFC";
        }else if(field.equals("vcCamelLAC")){
            return "vcCamelLac";
        }else if(field.equals("vcCamelCellID")){
            return "vcCamelCellID";
        }else if(field.equals("vcCamelTimeZone")){
            return "vcCamelTimeZone";
        }else if(field.equals("intCardNo")){
            return "uintCardNo";
        }else if(field.equals("intCardPort")){
            return "uintCardPort";
        }else if(field.equals("intCardSlot")){
            return "uintCardSlot";
        }else if(field.equals("sourceData")){
            return "vcSourceData";
        }else if(field.equals("eopCode")){
            return "uintEOpCode";
        }else if(field.equals("vcCallingFN")){
            return "vcCallingFN";
        }else if(field.equals("vcCalledFN")){
            return "vcCalledFN";
        }else if(field.equals("vcTrainNo")){
            return "vcTrainNo";
        }else if(field.equals("vcCamelPreCalledNumber")){
            return "vcCamelPreCalledNumber";
        }else if(field.equals("intCallingFN")){
            return "vcCallingFN";
        }else if(field.equals("intCalledFN")){
            return "vcCalledFN";
        }else{
            return "";
        }
    }

    /**
     * cap统计的实体字段翻译数据库字段
     * @param field
     * @return
     */
    public static String capFieldMapping(String field){
        if(field.equals("dtTime")){
            return "dtSTime";
        }else if(field.equals("intTotolCDR")){
            return "uintTotolCdr";
        }else if(field.equals("intTotolCDRCAP1")){
            return "uintTotolCdrCap_1";
        }else if(field.equals("intTotolCDRCAP2")){
            return "uintTotolCdrCap_2";
        }else if(field.equals("intTotolCDRCAP3")){
            return "uintTotolCdrCap_3";
        }else if(field.equals("intRespCDR")){
            return "uintRespCdr";
        }else if(field.equals("intRespCDRCAP1")){
            return "uintRespCdrCap_1";
        }else if(field.equals("intRespCDRCAP2")){
            return "uintRespCdrCap_2";
        }else if(field.equals("intRespCDRCAP3")){
            return "uintRespCdrCap_3";
        }else if(field.equals("intSuccCDR")){
            return "uintSuccCdr";
        }else if(field.equals("intSuccCDRCAP1")){
            return "uintSuccCdrCap_1";
        }else if(field.equals("intSuccCDRCAP2")){
            return "uintSuccCdrCap_2";
        }else if(field.equals("intSuccCDRCAP3")){
            return "uintSuccCdrCap_3";
        }else if(field.equals("intSuccCDRCAP1DivideIntTotolCDRCAP1")){
            return "intSuccCDRCAP1DivideIntTotolCDRCAP1";
        }else if(field.equals("intSuccCDRCAP2DivideIntTotolCDRCAP2")){
            return "intSuccCDRCAP2DivideIntTotolCDRCAP2";
        }else if(field.equals("intTotolRespDelay")){
            return "uintTotolRespDelay";
        }else if(field.equals("intMaxRespDelay")){
            return "uintMaxRespDelay";
        }else if(field.equals("capCause0")){
            return "uintCapCause_0";
        }else if(field.equals("capCause1")){
            return "uintCapCause_1";
        }else if(field.equals("capCause2")){
            return "uintCapCause_2";
        }else if(field.equals("capCause3")){
            return "uintCapCause_3";
        }else if(field.equals("capCause4")){
            return "uintCapCause_4";
        }else if(field.equals("capCause5")){
            return "uintCapCause_5";
        }else if(field.equals("capCause6")){
            return "uintCapCause_6";
        }else if(field.equals("capCause7")){
            return "uintCapCause_7";
        }else if(field.equals("capCause8")){
            return "uintCapCause_8";
        }else if(field.equals("capCause9")){
            return "uintCapCause_9";
        }else if(field.equals("capCause10")){
            return "uintCapCause_10";
        }else if(field.equals("capCause11")){
            return "uintCapCause_11";
        }else if(field.equals("capCause12")){
            return "uintCapCause_12";
        }else if(field.equals("capCause13")){
            return "uintCapCause_13";
        }else if(field.equals("capCause14")){
            return "uintCapCause_14";
        }else if(field.equals("capCause15")){
            return "uintCapCause_15";
        }else if(field.equals("capCause16")){
            return "uintCapCause_16";
        }else if(field.equals("intTcapAbort")){
            return "uintTcapAbort";
        }else if(field.equals("intTcapError")){
            return "uintTcapError";
        }else if(field.equals("intTcapReject")){
            return "uintTcapReject";
        }else if(field.equals("intSccpError")){
            return "uintSccpError";
        }else{
            return "";
        }
    }

    /**
     * map统计的实体字段翻译数据库字段
     * @param field
     * @return
     */
    public static String mapFieldMapping(String field){
        if(field.equals("dtTime")){
            return "dtSTime";
        }else if(field.equals("intTotalCDR")){
            return "uintTotalCdr";
        }else if(field.equals("intTotalCDRMAP1")){
            return "uintTotalCdrMap1";
        }else if(field.equals("intTotalCDRMAP2")){
            return "uintTotalCdrMap2";
        }else if(field.equals("intTotalCDRMAP3")){
            return "uintTotalCdrMap3";
        }else if(field.equals("intTotalCDRMAP4")){
            return "uintTotalCdrMap4";
        }else if(field.equals("intTotalCDRMAP5")){
            return "uintTotalCdrMap5";
        }else if(field.equals("intRespCDR")){
            return "uintRespCdr";
        }else if(field.equals("intRespCDRMAP1")){
            return "uintRespCdrMap1";
        }else if(field.equals("intRespCDRMAP2")){
            return "uintRespCdrMap2";
        }else if(field.equals("intRespCDRMAP3")){
            return "uintRespCdrMap3";
        }else if(field.equals("intRespCDRMAP4")){
            return "uintRespCdrMap4";
        }else if(field.equals("intRespCDRMAP5")){
            return "uintRespCdrMap5";
        }else if(field.equals("intSuccCDR")){
            return "uintSuccCdr";
        }else if(field.equals("intSuccCDRMAP1")){
            return "uintSuccCdrMap1";
        }else if(field.equals("intSuccCDRMAP2")){
            return "uintSuccCdrMap2";
        }else if(field.equals("intSuccCDRMAP3")){
            return "uintSuccCdrMap3";
        }else if(field.equals("intSuccCDRMAP4")){
            return "uintSuccCdrMap4";
        }else if(field.equals("intSuccCDRMAP5")){
            return "uintSuccCdrMap5";
        }else if(field.equals("intSuccCDRMAP1DivideIntTotalCDRMAP1")){
            return "intSuccCDRMAP1DivideIntTotalCDRMAP1";
        }else if(field.equals("intSuccCDRMAP2DivideIntTotalCDRMAP2")){
            return "intSuccCDRMAP2DivideIntTotalCDRMAP2";
        }else if(field.equals("intSuccCDRMAP3DivideIntTotalCDRMAP3")){
            return "intSuccCDRMAP3DivideIntTotalCDRMAP3";
        }else if(field.equals("intSuccCDRMAP4DivideIntTotalCDRMAP4")){
            return "intSuccCDRMAP4DivideIntTotalCDRMAP4";
        }else if(field.equals("intSuccCDRMAP5DivideIntTotalCDRMAP5")){
            return "intSuccCDRMAP5DivideIntTotalCDRMAP5";
        }else if(field.equals("intTotalRespDelay")){
            return "uintTotalRespDelay";
        }else if(field.equals("intMaxRespDelay")){
            return "uintMaxRespDelay";
        }else if(field.equals("intTotalOpDelay")){
            return "uintTotalOpDelay";
        }else if(field.equals("intMaxOpDelay")){
            return "uintMaxOpDelay";
        }else if(field.equals("uintMapCause0")){
            return "uintMapCause0";
        }else if(field.equals("uintMapCause1")){
            return "uintMapCause1";
        }else if(field.equals("uintMapCause1")){
            return "uintMapCause1";
        }else if(field.equals("uintMapCause2")){
            return "uintMapCause2";
        }else if(field.equals("uintMapCause3")){
            return "uintMapCause3";
        }else if(field.equals("uintMapCause4")){
            return "uintMapCause4";
        }else if(field.equals("uintMapCause5")){
            return "uintMapCause5";
        }else if(field.equals("uintMapCause6")){
            return "uintMapCause6";
        }else if(field.equals("uintMapCause7")){
            return "uintMapCause7";
        }else if(field.equals("uintMapCause8")){
            return "uintMapCause8";
        }else if(field.equals("uintMapCause9")){
            return "uintMapCause9";
        }else if(field.equals("uintMapCause10")){
            return "uintMapCause10";
        }else if(field.equals("intTcapUAbort")){
            return "uintTcapUAbort";
        }else if(field.equals("intTcapPAbort")){
            return "uintTcapPAbort";
        }else if(field.equals("intTcapError")){
            return "uintTcapError";
        }else if(field.equals("intTcapReject")){
            return "uintTcapReject";
        }else if(field.equals("intSccpError")){
            return "uintSccpError";
        }else{
            return "";
        }
    }


    public static String LinkFieldMapping(String field){
        return "";
    }

    //被叫功能号的解析
    public static String getChangHaoMa(String str, YingSheService yingSheService){
        String huStr;
        String ascStr;
        String ascStr1;
        String ascStr2;
        String haoStr;
        String gongStr;
        huStr = yingSheService.getMap("huJiaoLeiXingMap").get(str.substring(0,1));
        //取两位比较asc码表翻译  例如83 对应S   65对应 A
        ascStr1 = yingSheService.getMap("ascMaBiaoMap").get(str.substring(1,3));
        //取两位比较asc码表翻译
        ascStr2 = yingSheService.getMap("ascMaBiaoMap").get(str.substring(3,5));
        ascStr1 = ascStr1==null?"":ascStr1;
        ascStr2 = ascStr2==null?"":ascStr2;
        huStr = huStr==null?"":huStr;
        ascStr = ascStr1 + ascStr2;
        if(huStr.equals("机车功能号")){
            ascStr = "";
            haoStr = str.substring(1,str.length()-2);//机车功能号的翻译
        }else{
            haoStr = str.substring(5,str.length()-2);//车次或者其他都是这
        }
        gongStr = yingSheService.getMap("gongNengMaMap").get(str.substring(str.length()-2,str.length()));
        huStr = huStr==null?"":huStr;
        gongStr = gongStr==null?"":gongStr;
        return huStr + ascStr + haoStr + gongStr;
    }


    /**
     * 基础数据详细   字段对应数据库
     * @return
     */
    public static String basisDataMinuteMapping(String str){
        String value = "";
        if(str.equals("showvalue")){
            value = "showvalue";
        }else if(str.equals("actualvalue")){
            value = "actualvalue";
        }else{
            value="";
        }
        return value;
    }



    /**
     * ISUP话单 字段对应数据库
     * @return
     */
    public static Map<String,String> billedIsupColumnNameMapping(){
        Map<String,String> billedIsupColumnNameMap = new HashMap<>();

        billedIsupColumnNameMap.put("dtSTime","dtSTime");
        billedIsupColumnNameMap.put("uintInterfaceID","uintInterfaceID");
        billedIsupColumnNameMap.put("intOpc","uintOpc");
        billedIsupColumnNameMap.put("intDpc","uintDpc");
        billedIsupColumnNameMap.put("intResult","intResult");
        billedIsupColumnNameMap.put("intISUPCause","intCause");
        billedIsupColumnNameMap.put("vcCallingNumber","vcCallingNumber");
        billedIsupColumnNameMap.put("vcCalledNumber","vcCalledNumber");
        billedIsupColumnNameMap.put("uintCallingFN","vcCallingFN");
        billedIsupColumnNameMap.put("uintCalledFN","vcCalledFN");
        billedIsupColumnNameMap.put("vcSIP","vcSIP");
        billedIsupColumnNameMap.put("vcDIP","vcDIP");
        billedIsupColumnNameMap.put("intCIC","intCIC");
        billedIsupColumnNameMap.put("intResult","intResult");
        billedIsupColumnNameMap.put("vcOCalledNumber","vcOCalledNumber");
        billedIsupColumnNameMap.put("vcRedirectionNumber","vcRedirectionNumber");
        billedIsupColumnNameMap.put("intTransMR","intTransMR");
        billedIsupColumnNameMap.put("intMLPPLevel","intMLPPLevel");
        billedIsupColumnNameMap.put("sourceData","vcSourceData");
        billedIsupColumnNameMap.put("vcCallingImsi","vcCallingImsi");
        billedIsupColumnNameMap.put("vcCalledImsi","vcCalledImsi");
        return billedIsupColumnNameMap;
    }

    /**
     * ISUP话单 字段对应新数据库表
     * 20230310
     * @return
     */
    public static Map<String,String> billedIsupColumnNameMappingNew(){
        Map<String,String> billedIsupColumnNameMap = new HashMap<>();

        billedIsupColumnNameMap.put("dtSTime","dtSTime");
        billedIsupColumnNameMap.put("uintInterfaceID","uintInterfaceID");
        billedIsupColumnNameMap.put("intOpc","uintOpc");
        billedIsupColumnNameMap.put("intDpc","uintDpc");
//        billedIsupColumnNameMap.put("intResult","intResult");
        billedIsupColumnNameMap.put("intISUPCause","uintCause");
        billedIsupColumnNameMap.put("vcCallingNumber","vcCallingNumber");
        billedIsupColumnNameMap.put("vcCalledNumber","vcCalledNumber");
//        billedIsupColumnNameMap.put("uintCallingFN","vcCallingFN");
//        billedIsupColumnNameMap.put("uintCalledFN","vcCalledFN");
//        billedIsupColumnNameMap.put("vcSIP","vcSIP");
//        billedIsupColumnNameMap.put("vcDIP","vcDIP");
        billedIsupColumnNameMap.put("intCIC","intCic");
//        billedIsupColumnNameMap.put("intResult","intResult");
//        billedIsupColumnNameMap.put("vcOCalledNumber","vcOCalledNumber");
        billedIsupColumnNameMap.put("vcConnectedNumber","vcConnectedNumber");
        billedIsupColumnNameMap.put("intCardPort","intCardPort");
        billedIsupColumnNameMap.put("intReleaseStatus","intReleaseStatus");
//        billedIsupColumnNameMap.put("sourceData","vcSourceData");
//        billedIsupColumnNameMap.put("vcCallingImsi","vcCallingImsi");
//        billedIsupColumnNameMap.put("vcCalledImsi","vcCalledImsi");
        return billedIsupColumnNameMap;
    }

    /**
     * Fas话单 字段对应新数据库表
     * 20230310
     * @return
     */
    public static Map<String,String> billedFasColumnNameMappingNew(){
        Map<String,String> billedFasColumnNameMap = new HashMap<>();

        billedFasColumnNameMap.put("dtSTime","dtSTime");
        billedFasColumnNameMap.put("uintInterfaceID","uintInterfaceID");
        billedFasColumnNameMap.put("uintCause","uintCause");
        billedFasColumnNameMap.put("vcCallingNumber","vcCallingNumber");
        billedFasColumnNameMap.put("vcCalledNumber","vcCalledNumber");
        billedFasColumnNameMap.put("biSessID","biSessID");
        billedFasColumnNameMap.put("biBigSessID","biBigSessID");
        billedFasColumnNameMap.put("uintProtoTypeID","uintProtoTypeID");
        billedFasColumnNameMap.put("biCallRef","biCallRef");
        billedFasColumnNameMap.put("vcConnectedNumber","vcConnectedNumber");
        billedFasColumnNameMap.put("intCardPort","intCardPort");
        billedFasColumnNameMap.put("intReleaseStatus","intReleaseStatus");
        return billedFasColumnNameMap;
    }





    /**
     * 拼接查询sql语句（显示值）   根据显示值查询静态数据表里对应的数据
     * @param jsonArray 前端得到的json数据
     * @return
     */
    public static String jointSqlStatementsShowValue(JSONArray jsonArray){

        String sqlStr = "";
        for (int i = 0; i < jsonArray.size(); i++) {
            sqlStr += " or showvalue = " +  "'" + jsonArray.getJSONObject(i).getString("text") + " ' ";
        }

        StringBuilder sbSqlStr = new StringBuilder(sqlStr);
        sbSqlStr.replace(0,3," and (");
        return sbSqlStr + ")";
    }

    /**
     * 拼接查询sql语句（显示值）   根据显示值查询静态数据表里对应的数据
     * @param jsonArray 前端得到的json数据
     * @return
     */
    public static String jointSqlStatementsShowValueIsYinShe(JSONArray jsonArray){

        String sqlStr = "";
        for (int i = 0; i < jsonArray.size(); i++) {
            sqlStr += " or value = " +  "'" + jsonArray.getJSONObject(i).getString("text") + " ' ";
        }

        StringBuilder sbSqlStr = new StringBuilder(sqlStr);
        sbSqlStr.replace(0,3," and (");
        return sbSqlStr + ")";
    }

    /**
     * 拼接查询sql语句
     * @param
     * @return
     */
//    public static String jointSqlStatements(List<BasisDataMinute> list , String ColumnName){
//
//        String sqlStr = "";
//        for (int i = 0; i < list.size(); i++) {
//            sqlStr += " or " + ColumnName + " = " +  list.get(i).getActualvalue() + " ";
//        }
//
//        StringBuilder sbSqlStr = new StringBuilder(sqlStr);
//        sbSqlStr.replace(0,3," and (");
//        return sbSqlStr + ")";
//    }


    /*
     * 对Map<String,String>中的value进行排序（正序）
     */
    public static Map<String, String> sortMapByValue1(Map<String, String> unSortMap) {
        if (unSortMap == null || unSortMap.isEmpty()) {
            return null;
        }
        List<Map.Entry<String, String>> listEntry = new ArrayList<>();
        listEntry.addAll(unSortMap.entrySet());
        Collections.sort(listEntry, new Comparator<Map.Entry<String, String>>() {
            @Override
            public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
                // String的compareTo方法，返回负数，说明o1在o2的字典顺序之前。
                return o1.getValue().compareTo(o2.getValue());// 此处。getValue改成getKey即可对Map按照key进行排序
            }
        });
        Map<String,String> sortedMap = new LinkedHashMap<>();
        for(Map.Entry<String, String> entry : listEntry){
            sortedMap.put(entry.getKey(), entry.getValue());
        }
        return sortedMap;
    }



    /**
     * ISUP信令 字段对应数据库
     * @return
     */
    public static Map<String,String> signalingIsupColumnNameMapping(){
        Map<String,String> signalingIsupColumnNameMapping = new HashMap<>();
        signalingIsupColumnNameMapping.put("dtSTime","dtSTime");
        signalingIsupColumnNameMapping.put("uintInterfaceID","uintInterfaceID");
        signalingIsupColumnNameMapping.put("vcCallingNumber","vcCallingNumber");
        signalingIsupColumnNameMapping.put("vcCalledNumber","vcCalledNumber");
        signalingIsupColumnNameMapping.put("intOpc","uintOpc");
        signalingIsupColumnNameMapping.put("intDpc","uintDpc");
        signalingIsupColumnNameMapping.put("vcProtocol","vcProtocol");
        signalingIsupColumnNameMapping.put("vcInfo","vcInfo");
        signalingIsupColumnNameMapping.put("intCIC","intCIC");
        signalingIsupColumnNameMapping.put("intMTPType","uintMtpType");
        signalingIsupColumnNameMapping.put("uintIsupType","uintIsupMessageType");
//        signalingIsupColumnNameMapping.put("intISUPCause","intISUPCause");
        signalingIsupColumnNameMapping.put("uintEventInd","uintEventInd");
        signalingIsupColumnNameMapping.put("intISUPCause","uintCauseIndicator");
        signalingIsupColumnNameMapping.put("vcConnectedNumber","vcConnectedNumber");
        signalingIsupColumnNameMapping.put("uintCardNo","intCardNo");
        signalingIsupColumnNameMapping.put("uintCardPort","intCardPort");
        signalingIsupColumnNameMapping.put("uintCardSlot","intCardSlot");
        signalingIsupColumnNameMapping.put("SourceData","vcSourceData");
        return signalingIsupColumnNameMapping;
    }

    /**
     * FAS信令 字段对应数据库
     * @return
     */
    public static Map<String,String> signalingFasColumnNameMapping(){
        Map<String,String> signalingFasColumnNameMapping = new HashMap<>();
        signalingFasColumnNameMapping.put("dtSTime","dtSTime");
        signalingFasColumnNameMapping.put("biSessID","biSessID");
        signalingFasColumnNameMapping.put("intTei", "intTei");
        signalingFasColumnNameMapping.put("intNr","intNr" );
        signalingFasColumnNameMapping.put("intNs","intNs" );
        signalingFasColumnNameMapping.put("intFrameType","intFrameType" );
        signalingFasColumnNameMapping.put("intQ931Disc", "intQ931Disc" );
        signalingFasColumnNameMapping.put("intQ931CallRef","intQ931CallRef" );
        signalingFasColumnNameMapping.put("vcProtocol","vcProtocol");
        signalingFasColumnNameMapping.put("vcInfo","vcInfo");
        signalingFasColumnNameMapping.put("uintInterfaceID", "uintInterfaceID");
        signalingFasColumnNameMapping.put("vcCallingNumber","vcQ931CallingNum" );
        signalingFasColumnNameMapping.put("vcCalledNumber","vcQ931CalledNum" );
        signalingFasColumnNameMapping.put("intQ931CallRefLen","intQ931CallRefLen" );
        signalingFasColumnNameMapping.put("intQ931CallRefFlag","intQ931CallRefFlag");
        signalingFasColumnNameMapping.put("intQ931MessageType","intQ931MessageType");
        signalingFasColumnNameMapping.put("intQ931Cause","intQ931Cause");
        signalingFasColumnNameMapping.put("vcQ931ConnetedNum","vcQ931ConnetedNum");
        signalingFasColumnNameMapping.put("intDevNum","intDevNum" );
        signalingFasColumnNameMapping.put("intPortNum","intPortNum");
        signalingFasColumnNameMapping.put("intSlotNum","intSlotNum");
        signalingFasColumnNameMapping.put("DataLen","DataLen");
        signalingFasColumnNameMapping.put("sourceData","sourceData");
        return signalingFasColumnNameMapping;
    }
}
